<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>挺赞洗衣</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
	<link rel="stylesheet" href="__PUBLIC__/client/css/cui.css?sj={$tj}" />
	<link rel="stylesheet" href="__PUBLIC__/client/css/slick.css?sj={$tj}" />
	<link rel="stylesheet" href="__PUBLIC__/client/css/style.css?sj={$tj}" />
	<script type="text/javascript" src="__PUBLIC__/client/js/jquery.js"></script>
    <script type="text/javascript" src="__PUBLIC__/client/js/lib.js?sj={$tj}"></script>
</head>
<body class="mhome">
	<div class="viewport">
		<!--<div class="sitemap">
			<a href="{:U('Client/wo/woinfo')}" class="goback"></a>绑定手机
		</div>-->
		<!--end header-->
		<div id="bd" class="bd5 fix">
			<ul>
                <li class="li1">
                    <span>{$session.user.phone}</span>已绑定手机
                </li>
                <li class="li2">
                    <p>
                        <em class="empty"></em><input type="text" name="tel" class="fsphone"  id="hm-inp-3" placeholder="请输入新绑定手机号">
                    </p>
                    更换绑定手机
                </li>
                <li class="li3">
                    <p>
                        <em class="empty"></em><input type="text" name="msg" class="fxyam" id="hm-inp-3" placeholder="请输入短信验证码" st>
                    		
                    </p>
                    <button id="dxyzm" class="hm-inp-4 btn-yellow btn-yellow-2" style="width: 80px; float: right; font-size: 10px;">发送验证码</button>
                    验证短信
                </li>
            </ul>
            <div>
                <input type="button" id="submit" value="更换" class="hm-inp-4 btn-yellow btn-yellow-2">
            </div>
		</div>
		<div class="c"></div>
		<!--end #bd-->
	</div>
</body>
	<script src="__PUBLIC__/business/js/normal.js"></script>
<script>

//下单
$('#submit').on('click',function(){
	var phone=$('.fsphone').val();
	var yzm=$('.fxyam').val();
	if(!checkTel(phone)){
		Msg('请填写正确的手机号码！',2);
	}
	if(!yzm){
		Msg('请填写验证码！',2);
	}
				
	if(phone && yzm){
		var tourl="{:U('Client/api/edit_phone')}";
		var data=$('#bbForm').serialize();
		 $.post(tourl,{phone:phone,yzm:yzm },function(data){
		    if(data.status==1){
		    		Msg('更该成功!',1);
		    		
		    		setTimeout(function(){
					window.location.href="{:U('Client/wo/woinfo')}";
				},1000);
				
		    }else if(data.status==2){
		    		Msg('验证码错误!',2);
		    }else{
		    		Msg('更该失败!',2);
		    }
		 });
	}
});

$("#dxyzm").click(function(){ 
	var phone=$('.fsphone').val();
	if(!checkTel(phone)){
		Msg('请输入正确的手机号码！',2);
	}else{
		time($("#dxyzm"));
		var tourl="{:U('Client/api/code')}";
		$.post(tourl, {'phone': phone },function(data){
			//alert(data)
		    	if(data.status=='1'){
		    		//alert('验证码发送成功!');
		    	}else{
		    		Msg('验证码发送失败! 请您重试。',3);
		    	}
		});
	}
	
});

var wait=60;  
function time(o){
    if (wait == 0) {  
        o.attr("disabled", false);
        o.html('获取验证码');
        wait = 60;  
    }else{  
        o.attr("disabled", true); 
        o.html("重新发送(" + wait + ")");
        wait--;
        setTimeout(function() {  
            time(o)  
        },  
        1000)
    }  
}  
</script>